import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;

public class Server_Information
{
	// static String
	// update_status_url="http://canss.net/CANSSWebService/svtAjaxContentStatusUpdate";
	static String update_status_url = "http://mediator.canss.net/ServiceManager/UpdateContentStatus.php";
	static String get_feed_portal_url = "http://canss.net/CANSSWebService/svtAjaxFeedlist";
	static String receptionist_url = "http://mediator.canss.net/ServiceManager/Register_Service.php";
	static String Aggregator_Status_check_url = "http://canss.net/CANSSWebService/svtAjaxModuleStatusUpdate";

	static String Upload_FTP_url = "mediator.canss.net";
	static String Upload_FTP_ID = "khj";
	static String Upload_FTP_PW = "1022";

	@SuppressWarnings("deprecation")
	public static void Update_Status(String cid, int code)
	{
		HttpClient client = new HttpClient();
		PostMethod method = new PostMethod(update_status_url);
		System.out.println(cid);
		if (cid.lastIndexOf(".") != -1)
		{
			NameValuePair[] data = new NameValuePair[] {
					new NameValuePair("_cid", cid.substring(0, cid
							.lastIndexOf("."))),
					new NameValuePair("_status", String.valueOf(code)) };
			client.setTimeout(10000);
			method.setRequestBody(data);
			try
			{
				client.executeMethod(method);
				method.getResponseBodyAsString();

				// System.out.println("Download Complete:" + cid);
			} catch (HttpException e)
			{
				e.printStackTrace();
			} catch (IOException e)
			{
				// 
				e.printStackTrace();
			}
		} else
		{
			NameValuePair[] data = new NameValuePair[] {
					new NameValuePair("_cid", cid),
					new NameValuePair("_status", String.valueOf(code)) };
			client.setTimeout(10000);
			method.setRequestBody(data);
			try
			{
				client.executeMethod(method);
				method.getResponseBodyAsString();

				// System.out.println("Download Complete:" + cid);
			} catch (HttpException e)
			{
				e.printStackTrace();
			} catch (IOException e)
			{
				// 
				e.printStackTrace();
			}
		}
	}
}
